<?php
/**
 * Basic Controller
 *
 * @author      Hyper <hyper@flashbay.com>
 * @copyright   Copyright (c) 2011 (http://www.saleshero.com)
 */
class SalesHero_Controller_Action extends Zend_Controller_Action
{

    /**
     * db
     *
     * @var Zend_Db_Adapter_Abstract
     */
    public $db = null;

    /**
     * Application config
     *
     * @var Zend_Config
     */
    public $config = null;

    /**
     * Constructor
     */
    public function __construct(Zend_Controller_Request_Abstract $request,
                                Zend_Controller_Response_Abstract $response,
                                array $invokeArgs = array())
    {
        parent::__construct($request, $response, $invokeArgs);
        $this->db = Zend_Registry::get('db');
        $this->config = Zend_Registry::get('config');

        $request = $this->getRequest();
        $this->view->module = $request->getParam('module');
        $this->view->controller = $request->getParam('controller');
        $this->view->action = $request->getParam('action');
    }

    /**
     * Show feedback template.
     *
     * @param  array    $params
     * @param  string   $template
     */
    public function feedback(array $params = array(), $template = 'feedback.phtml')
    {
        $this->view->title = isset($params['title']) ? $params['title'] : 'Feedback Message';
        $this->view->message = isset($params['message']) ? $params['message'] : 'Success!';
        $this->view->redirect = isset($params['redirect']) ? $params['redirect'] : 'javascript:history.go(-1);';
        $this->view->linktext = isset($params['linktext']) ? $params['linktext'] : 'Go Back';
        $this->view->refresh = isset($params['refresh']) ? $params['refresh'] : 5;

        echo $this->view->render($template);
        exit;
    }
}